import request from './http.request'

//账号密码登陆
export function login(params, data) {
  return request({
    url: '/auth/oauth/token',
    method: 'post',
    params: params,
    data,
  })
}

//获取租户id
export function getTenantId(username) {
  return request({
    url: `/admin/user/tenant/${username}`,
    method: 'get',
  })
}

//获取租户列表
export function getTenantList(params) {
  return request({
    url: '/admin/tenant/list',
    method: 'get',
    params: params,
  })
}

//微信登录
export function loginByWechat(code) {
  return request({
    url: `/admin/social/login/WX@${code}`,
    method: 'get',
  })
}

//微信绑定
export function bindWechat(code) {
  return request({
    url: `/admin/social/bindzz?state=WX&code=${code}`,
    method: 'post',
  })
}

//获取项目列表
export function getProjects() {
  return request({
    url: '/admin/user/get-projects',
    method: 'get',
  })
}

//获取项目菜单列表
export function getMenuList(id) {
  return request({
    url: '/admin/menu/smartBuild/tree/' + id,
    method: 'get',
  })
}

//获取全部设备列表
export function getALLDeviceList() {
  return request({
    url: '/dc/device/list-group-by-type',
    method: 'get',
  })
}

//退出
export function logout() {
  return request({
    url: '/auth/token/logout',
    method: 'delete',
  })
}
